from wxmbot.raw_func import *
from wxmbot.app import bot


__plugin_name__ = 'plugin_name__'
__plugin_usage__ = '__plugin_usage__'


@bot.on_command("test", arg_type='list')
def test(args, session):
    session.send_text_msg(str(args))

@bot.on_command("test1", arg_type='url')
def test1(args, session):
    session.send_text_msg(str(args))

@bot.on_command("test2")
def test2(args, session):
    info = bot.session.info
    robot_wxid = info['robot_wxid']
    from_wxid = info['from_wxid']
    send_text_msg(robot_wxid, from_wxid, f'你好' * 5)

@bot.on_command("all_friend_info")
def 所有好友信息(args, session):
    ret = session.get_friend_list()[0]
    session.send_text_msg(str(ret))



@bot.on_command("test_all")
def test_all(args, session):
    info = session.info
    robot_wxid = info['robot_wxid']
    from_wxid = info['from_wxid']
    try: final_from_wxid = info['final_from_wxid']
    except: pass

    arg = int(''.join(args))

    if arg == 1: ret = get_robot_headimgurl(robot_wxid)
    elif arg == 2: ret = get_logged_account_list()
    elif arg == 3: ret = get_friend_list(robot_wxid, is_refresh=1)
    elif arg == 4: ret = get_group_list(robot_wxid, is_refresh=1)
    elif arg == 5: ret = get_group_member(robot_wxid, from_wxid, final_from_wxid, is_refresh=1)
    elif arg == 6: ret = get_group_member_list(robot_wxid, from_wxid, is_refresh=1)
    else: ret = get_robot_name(robot_wxid)

    send_text_msg(robot_wxid, from_wxid, str(ret))
